/*=============================================================================
*
*   Copyright (C) 2020 All rights reserved.
*
*   Filename:		P91.cpp
*
*   Author: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Date: 2020-02-20 21:23
*
*   Last Editors: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Last modified:	2020-06-07 21:40
*
*   Description:
*
=============================================================================*/
#include "../../include/biot.hpp"
#include "../../include/fem.hpp"
#include "../../include/implicit_solver.hpp"
#include "../../include/incremental_load.hpp"
#include "../../include/io/data_extractor.hpp"
#include "../../include/io/vtu_writer.hpp"
#include "../../include/model/model.hpp"
#include "../../include/static_equation.hpp"

LOGGING_REGISTER()

int main(int argc, char* argv[]) {

  using namespace geoxfem;

  using MethodPolicy   = model::fem;
  using CouplePolicy   = model::biot;
  using DimensionType  = geometry::plane_strain;
  using EquationPolicy = model::static_equation;
  using SolvePolicy    = model::implicit_solver;
  using LoadPolicy     = model::incremental_load;
  using Model =
    geoxfem::model::Model<MethodPolicy, CouplePolicy, DimensionType,
                          EquationPolicy, SolvePolicy, LoadPolicy, mpl1>;
  Model model;

  std::string input_file_name = "test/test_P91/P91.json";

  /*  detail, trace, process, info, warning, debug, error }; */
  geoxfem::log::log_init(geoxfem::log::severity_level::error);

  io::DataParser<io::json> parser;
  parser.read(input_file_name);

  io::DataExtractor<Model> extractor;
  extractor.append(4, "pore");
  extractor.append(0, "x1");

  io::DataWriter<Model, io::vtu> writer;
  writer.init(parser.getPath(), parser.getFileName());

  /* io::DataPloter                 ploter; */

  model.append(&extractor);
  model.append(&writer);

  model.getMesh()->plot();

  model.init(parser);
  model.buildProblem();
  model.solveProblem();

  extractor.plotDofData();

  return 0;
}

